package com.tencent.iov.cowin.befsale.clue.value.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.stream.Stream;

/**
 * @Describe: 性别枚举
 * @author: zly
 * @created: 2022-01-20
 * @version: 1.0
 */
@Getter
@AllArgsConstructor
public enum GenderEnum {

    // 性别：1：男，2：女，0：未知
    GENDER_UNKNOWN(0,"未知"),
    GENDER_MALE(1,"男"),
    GENDER_FEMALE(2,"女");

    Integer code;
    String name;

    public static GenderEnum getByCode(Integer code) {
        return Stream.of(GenderEnum.values()).filter(genderEnum ->
                genderEnum.getCode().equals(code)).findAny().orElse(null);
    }
}
